package com.agileboot.domain.examrecord.query;

import com.agileboot.common.core.page.AbstractPageQuery;
import com.agileboot.domain.exam.db.Exam;
import com.agileboot.domain.examrecord.db.ExamRecord;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * @author lx
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
public class ExamRecordQuery extends AbstractPageQuery<ExamRecord> {
    //试卷id
    private Integer examId;
    //试卷名称
    private String examName;

    @Override
    public QueryWrapper<ExamRecord> addQueryCondition() {
        QueryWrapper<ExamRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(examId!=null, "exam_id", examId);
        queryWrapper.like(StringUtils.isNotBlank(examName), "exam_name", examName);
        return queryWrapper;
    }
}
